using System.Collections.Generic;
using System.Linq;
using FogBugz.Bridge;
using NUnit.Framework;
using StickyNotesPrinter.Core;

namespace StickyNotesPrinter.Specs.FogBugz
{
    [TestFixture]
    public class loading_iterations_and_cases
    {
        private ApiSettings _settings;

        [SetUp]
        public void Given()
        {
            _settings = new ApiSettings("hernan@sureflix.com", "112233", "https://sureflix.fogbugz.com/api.asp");
        }

        [Test]
        public void When_calling_getIterations_Should_load_a_list_of_Iterations()
        {
            ITrackerApi tracker = new Api(_settings);
            IEnumerable<Iteration> iterations = tracker.GetIterations();

            Assert.That(iterations.Count(), Is.GreaterThan(0));
        }

        [Test]
        public void When_calling_getCases_Should_load_a_list_of_cases()
        {
            ITrackerApi tracker = new Api(_settings);
            var iteration = new Iteration {Id = 180, Name = "Tools_SignUp_Sprint"};
            IEnumerable<Story> stories = tracker.GetStoriesForIteration(iteration);

            Assert.That(stories.Count(),Is.GreaterThan(0));
        }
    }
}